﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="css/table.css">
<link href="css/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
	function pwTest(){
		var newPw = $("#newPw").val();
		var repeatPw =$("#repeatPw").val();
		if(newPw != repeatPw && repeatPw!=''&& newPw!=''){
			$("#errorinfo").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">与新密码不一致！</font>");
		}else{
			$("#errorinfo").html("");
		}
	}
	
	var judge=false;
	function pworiginal(){
		var originalPw = $("#originalPw").val();
		if(originalPw!=''){
		var param ={"originalPw":originalPw}
		$.post("pwverify.action",param,function(data){
			if(data!='success'){
				$("#errorinfo1").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">密码错误</font>");
				judge=false;
			}else{
				$("#errorinfo1").html("");
				judge=true;
			}
		});}
	}
function updatepsw(){
	var originalPw = $("#originalPw").val()
	var newPw = $("#newPw").val()
	var repeatPw=$("#repeatPw").val()
	if(originalPw == ''){
		$("#errorinfo1").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">请输入原密码</font>");
		return; 
	}else{
	$("#errorinfo1").html("");
	}
	if(newPw==''){
		$("#errorinfo2").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">请输入新密码</font>");
		return; 	
	}else{
	$("#errorinfo2").html("");
	}
	if(repeatPw==''){
		$("#errorinfo").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">请再次输入新密码</font>");
		return; 
	}else{
	$("#errorinfo").html("");
	}
	pworiginal();
	if(newPw==repeatPw&&judge){
	var param ={"uspsw":newPw}
	$.post("updatepsw.action",param,function(data){
		if(data=='success'){
			alert("修改成功");
			window.location.href="loginOut.action";
		}
	});}else{
		if(newPw==repeatPw){
			$("#errorinfo").html("");
		}else{
			pwTest();
		}
	}
}

</script>
<title>Insert title here</title>
</head>
<body>
<table  border="0" cellpadding="0" cellspacing="0" width="400px">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
         <td>个人办公 &gt; 我的办公桌 &gt; 密码设置</td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>
<form action="">
<table style="margin-top: 10px" id="tablePsw">
<tr><td>原始密码：</td><td><input maxlength="50" style="width: 145px;height: 18px" id="originalPw" name="originalPw" onblur="pworiginal()" type="password"/><span id="errorinfo1"></span></td></tr>
<tr><td>新密码：</td><td><input maxlength="50" style="width: 145px;height: 18px" id="newPw" id="" onblur="pwTest()" type="password"/><span id="errorinfo2"></span></td></tr>
<tr><td>重复新密码：</td><td><input maxlength="50" style="width: 145px;height: 18px" id="repeatPw" onblur="pwTest()" type="password"/><span id="errorinfo"></span></td></tr>
<tr><td colspan="2"><input type="button"  class="button_02" value="修改" onclick="updatepsw()"  />&nbsp;<input  class="button_02" type="reset" value="重置"/></td></tr>
</table>
</form>
</td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
</body>
</html>